<?php

namespace ImiApp\ApiServer\Common;

use Imi\App;
use Imi\Db\Db;
use Imi\AppContexts;
use ImiApp\amis\Baset\Path;
use ImiApp\amis\Baset\Image;
use ImiApp\amis\other\Avatar;
use Imi\Util\Http\Consts\MediaType;
use Imi\Server\Http\Message\Response;
use Imi\Util\Http\Consts\ResponseHeader;
use Imi\Server\Http\Controller\HttpController;
use Imi\Server\Http\Route\Annotation\Action;
use Imi\Server\Http\Route\Annotation\Controller;
use Imi\Server\Http\Route\Annotation\Route;
use Imi\Server\View\Annotation\HtmlView;
use Imi\Server\View\Annotation\View;

/**
 * @Controller("/")
 * @HtmlView(baseDir="index/")
 */
class BasetController extends HttpController
{
    protected function getImg($url)
    {
        return $this->response->setHeader(ResponseHeader::CONTENT_TYPE, MediaType::IMAGE_PNG)
            ->getBody()->write(file_get_contents(Path::App() . $url));
    }
}
